package com.cooge.media.proxy;

import org.apache.http.message.BasicHeader;


public class UrlAnalysis {
	
	 public enum TYPE {
	        FIEL, HTML, M3U8;
	    }
	
	private String enUrl;
	
	private TYPE type =TYPE.FIEL;
	
	
	public UrlAnalysis(String host,String url){
		String encoede = Base164.encodeToString(url);
		String eurl = "http://"+host+"/"+encoede;
		this.enUrl = eurl;
	}
	
	
	
	public UrlAnalysis(String url,BasicHeader... headers){
		String encoede = Base164.encodeToString(url);
		String eurl = "http://127.0.0.1:"+LiveProxy.port+"/"+encoede;
		
		if(headers.length>0){
			eurl = NetUtil.AdditionHeader(eurl, headers);
		}
		this.enUrl = eurl;
	}

	public String getEnUrl() {
		return enUrl;
	}


	public TYPE getType() {
		return type;
	}

	public void setType(TYPE type) {
		this.type = type;
	}
	
	

	public static void main(String[] args) {
		
		//User-Agent: SuperNode Downloader
		BasicHeader bh = new BasicHeader("User-Agent","SuperNode Downloader");
		UrlAnalysis url = new UrlAnalysis("http://101.71.18.12:8080/m3u8/cctv1HD_1300/desc.m3u8?stream_id=cctv1HD_1300&path=101.71.18.22,101.71.18.121&ltm=1422962691&lkey=6f70aa1c44ab7226af28147726fe7396&platid=10&splatid=1011&keyitem=platid,splatid,stream_id&ntm=1422962691&nkey=adf29147e4432546fa5af1bc0e5b4f06&tag=live&video_type=m3u8&useloc=0&mslice=5&errc=0&buss=0&qos=2&cips=112.65.128.246&geo=CN-9-123-2&tmn=1422944691&pnl=701,701,284&rson=1&appid=1000&cde=952&cdeid=4ba775687083720624ef6138cd6ddbba&ext=m3u8&hwtype=MP-B-303&key=9b496d8eb24c14b0256d70c5a5655089&lsbv=2bt&lsdg=ElEIhoRgs697VietTU62833riCuI&lsst=0&lssv=uQTVl_T0_SGJ_Vd32_PD75AACA5202E1AD242503ECEDFDFBE6A_MlWoGkcET_L23SJ2U&lstm=1YIWuo&m3v=1&ostype=android&play=0&playid=1&sign=live_tv&termid=3&tm=1422944990&tss=tvts",bh);
		System.out.println(url.getEnUrl());
		try {
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
